package com.mz.ozy.mvp.model;

import android.content.Context;

import com.mz.ozy.constants.Constants;
import com.mz.ozy.net.RetrofitUtils;
import com.mz.ozy.utils.JsonUtils;
import com.mz.ozy.utils.MD5Util;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class RegisterModel {


    public Observable<ResponseBody> onRegister(Context context, String uname, String userName,  String code, String password, String paypwd, String tjr) {
        Map<String, String> maps = new HashMap<>();
        maps.put("username", uname);
        maps.put("userphone", userName);
        maps.put("code", code);
        maps.put("password", MD5Util.getMD5String(password));
        maps.put("paypwd", MD5Util.getMD5String(paypwd));
        maps.put("pusername", tjr);
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10002, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }




    public Observable<ResponseBody> getCode(Context context, String mobilePhone, String ivCode) {
        Map<String, String> maps = new HashMap<>();
        maps.put("username", mobilePhone);
        maps.put("veriCode", ivCode);
        maps.put("actionType", "R");
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10001, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

    public Observable<ResponseBody> getCaptcha(Context context) {
        return RetrofitUtils.getApiService(context).getCaptcha();
    }

}
